package org.csu.hotelsys.service.impl;

import org.csu.hotelsys.domain.Check_in;
import org.csu.hotelsys.domain.Room_Reserve;
import org.csu.hotelsys.persistence.FormMapper;
import org.csu.hotelsys.service.FormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class FormServiceImpl implements FormService {

    @Autowired
    private FormMapper formMapper;

    @Override
    public List<Check_in> getAllCheck_in() {
        List list;
        list = formMapper.getAllCheckIn();
        return list;
    }

    @Override
    public List<Room_Reserve> getAllRoom_Reserve() {
        List list;
        list = formMapper.getAllRoomReserve();
        return list;
    }


    @Override
    public List<Check_in> getAllCheck_out() {
        List list;
        list = formMapper.getAllCheckOut();
        return list;
    }

    @Override
    public List<Check_in> getCheck_in(String start, String end) {
        List list = new ArrayList();
        if (start != null && end != null) {
            list = formMapper.getCheckInByTime(start, end);
        }
        return list;
    }

    @Override
    public List<Check_in> getCheck_in(String now) {
        List list = new ArrayList();
        if (now != null) {
            list = formMapper.getCheckInByNow(now);
        }
        return list;
    }

    @Override
    public List<Room_Reserve> getRoom_Reserve(String start, String end) {
        List list = new ArrayList();
        if (start != null && end != null) {
            list = formMapper.getReserveByTime(start, end);
        }
        return list;
    }

    @Override
    public List<Room_Reserve> getRoom_Reserve(String now) {
        List list = new ArrayList();
        if (now != null) {
            list = formMapper.getCheckInByNow(now);
        }
        return list;
    }

    @Override
    public List<Check_in> getCheck_out(String now) {
        List list = new ArrayList();
        if (now != null) {
            list = formMapper.getCheckOutByNow(now);
        }
        return list;
    }

    @Override
    public List<Check_in> getCheck_out(String start, String end) {
        List list = new ArrayList();
        if (start != null && end != null) {
            list = formMapper.getCheckOutByTime(start, end);
        }
        return list;
    }


}
